home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / TSR / TPPOP18C / POPDICE.PAS < prev    next >
Pascal/Delphi Source File  |  1988-11-03  |  2KB  |  63 lines

  1. {$A+,B-,D+,E+,F-,I+,L+,N+,O-,R-,S-,V-}
  2. {$M 1024,5120,5120}
  3. Program PopUpDice;
  4.  
  5. Uses Crt,           { use the BIOS for video - REQUIRED }
  6.      Dice,          { dice rolling main unit            }
  7.      PopUp,         { low-level popup control routines  }
  8.      Windows;       { simple windowing package          }
  9.  
  10. Const
  11.   Version = '1.0';
  12.   Signature = $89;          { must be greater than $80 }
  13.  
  14. Var
  15.   CommandLine : ^String;
  16.   Hotkey      : Word;
  17.   Result      : Word;
  18.   Temp        : String[4];
  19.   ErrorCode   : Byte;
  20.  
  21. {$F+}
  22. Procedure UpperCase(Var Line : String); External; {$L upprcase.obj}
  23. {$F-}
  24.  
  25. Procedure Copyright;
  26.  
  27. Begin
  28.   WriteLn;
  29.   WriteLn('PopDice Version ',Version,' (c) Copyright 1988 Ross Neilson Wentworth');
  30.   WriteLn;
  31. End;
  32.  
  33. Begin
  34.   Copyright;                                  { display my name          }
  35.   ErrorCode := Installed(Signature);          { see if we can install    }
  36.   If ErrorCode <> 0 Then
  37.   Begin                                       { already or can't install }
  38.     Case ErrorCode Of
  39.       1 : WriteLn('This program must be loaded before PRINT.COM');
  40.       2 : WriteLn('Already Installed');
  41.       3 : WriteLn('Internal error, can''t install');
  42.     End;
  43.     Halt(ErrorCode);                          { return an error code     }
  44.   End;
  45.   CommandLine := Ptr(PrefixSeg,$0080);        { point to command line    }
  46.   UpperCase(CommandLine^);                    { convert to uppercase     }
  47.   Hotkey := Alt + LeftShift + $20;            { default hot key          }
  48.   If ParamCount > 0                           { user defined hot key?    }
  49.     Then Begin
  50.       Temp := ParamStr(1);             { convert command line to hot key }
  51.       Val('$'+Temp,HotKey,Result);
  52.       If (Result <> 0) or (Length(Temp) <> 4) Then
  53.       Begin                          { if error, halt with error message }
  54.         WriteLn('Error in HotKey definition!  Program aborted.',^G);
  55.         Halt(4);                              { return code }
  56.       End;
  57.       WriteLn('User defined HotKey!');
  58.     End
  59.   Else WriteLn('Press ALT + LeftShift + D to activate');
  60. {  ReleaseEnvironment;                          { release unneeded memory     }
  61.   StayResident(Signature,@PopDice,Nil,HotKey); { terminate and stay resident }
  62. End.
  63.